class PSTutorialGFX extends GFxMoviePlayer;

var GFxObject mc, kbES, kbEN, padES, padEN;
var string tutSequence[8], tutSequenceEnd[8];

var int actualSeqInd, newSeqInd; // control de la sequencia de tutorial, para las animaciones
var int idioma,newidioma;
var bool bGamepad,newbGamepad;

function bool Start(optional bool StartPaused = false)
{
    super.Start();
    Advance(0);

	tutSequence[0]="_blank";
	tutSequence[1]="tut1";
	tutSequence[2]="tut2";
	tutSequence[3]="tut3";
	tutSequence[4]="tut4";
	tutSequence[5]="tut5";
	tutSequence[6]="tut6";
	tutSequence[7]="tut7";

	tutSequenceEnd[0]="_blank";
	tutSequenceEnd[1]="tut1b";
	tutSequenceEnd[2]="tut2b";
	tutSequenceEnd[3]="tut3b";
	tutSequenceEnd[4]="tut4b";
	tutSequenceEnd[5]="tut5b";
	tutSequenceEnd[6]="tut6b";
	tutSequenceEnd[7]="tut7b";

	mc = GetVariableObject("_root");
	kbES = GetVariableObject("_root.tutKBES");
	kbEN = GetVariableObject("_root.tutKBEN");
	padES = GetVariableObject("_root.tutPADES");
	padEN = GetVariableObject("_root.tutPADEN");

	return true;
}

function tutorialGoto(int _idioma, bool _bGamepad, int _tutSeqInd)
{
	// set new parameters
	newidioma = _idioma;
	newbGamepad = _bGamepad;
	newSeqInd = _tutSeqInd;

	if(actualSeqInd==0 || idioma==0)
	{
		//direct call
		GotoNewTutorial();
	}
	else
	{
		// play fade out
		if(idioma==1)
		{
			if(bGamepad)
			{
				padES.GotoAndPlay(tutSequenceEnd[actualSeqInd]);
			}
			else
			{
				kbES.GotoAndPlay(tutSequenceEnd[actualSeqInd]);
			}
		}
		else if(idioma==2)
		{
			if(bGamepad)
			{
				padEN.GotoAndPlay(tutSequenceEnd[actualSeqInd]);
			}
			else
			{
				kbEN.GotoAndPlay(tutSequenceEnd[actualSeqInd]);
			}
		}

		// and wait for sequence end in flash and call GotoNewTutorial()
	}



}

function GotoNewTutorial()
{
    if(newidioma==1)
	{
		if(newbGamepad)
		{
			padES.GotoAndPlay(tutSequence[newSeqInd]);
		}
		else
		{
			kbES.GotoAndPlay(tutSequence[newSeqInd]);
		}
	}
	else if(newidioma==2)
	{
		if(newbGamepad)
		{
			padEN.GotoAndPlay(tutSequence[newSeqInd]);
		}
		else
		{
			kbEN.GotoAndPlay(tutSequence[newSeqInd]);
		}
	}

	actualSeqInd = newSeqInd;
	bGamepad=newbGamepad;
	idioma = newidioma;
}

DefaultProperties
{
	bEnableGammaCorrection=FALSE
	bPauseGameWhileActive=false
	bCaptureInput=false
	MovieInfo = SwfMovie'PS_flash_tutorial.PS_tutorial'

	actualSeqInd = 0
}
